<!-- 富民极速贴现 -->
<template>
    <div>
        <el-form class="demo-ruleForm demo-ruleForm1" :model="form" :rules="rules" ref="form">
            <el-row class="check_error_box_speed" v-if="form.fbank_enterprise_status == 2 || form.fbank_enterprise_status == 4">
                <el-col :span="24" class="check_error_con_speed">&nbsp;<i class="iconfont icon-jingshi"></i>&nbsp;审核未通过原因：{{form.reason4}}</el-col>
            </el-row>
            <DiscountTitle title="客户信息" class="discount-step1"/>
            <div class="discount-customer-box form-box">
                <div class="edit-discount-customer">
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="公司名称：" prop="enterpriseName">
                                    <el-input class="approve-int" v-model="form.enterpriseName" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="机构类型：" prop="orgNature">
                                    <el-select class="approve-int" v-model="form.orgNature" placeholder="请选择">
                                        <el-option
                                                v-for="item in orgNatureList"
                                                :key="item.orgNature"
                                                :label="item.orgNatureName"
                                                :value="item.orgNature">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="贷款卡号/中征号：" prop="loanCardNo">
                                    <el-input class="approve-int" v-model="form.loanCardNo" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark" @click="isShowFinance()">
                                <el-form-item label="客户类型：" prop="financeType1">
                                    <FinanceType class="approve-int" ref="finance" v-model="form.finance"></FinanceType>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark" @click="isShowOrgFn()">
                                <el-form-item label="企业类型：" prop="orgType">
                                    <OrgType class="approve-int" ref="orgArr" v-model="form.orgArr"></OrgType>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="企业所有制类型：" prop="orgOwnerShipType">
                                    <el-select class="approve-int" v-model="form.orgOwnerShipType" placeholder="请选择">
                                        <el-option
                                                v-for="item in orgOwnerShipTypeList"
                                                :key="item.orgOwnerShipType"
                                                :label="item.orgOwnerShipTypeName"
                                                :value="item.orgOwnerShipType">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark" @click="isShowIndustryFn()">
                                <el-form-item label="国际行业分类：" prop="industryArr">
                                    <IndustryType class="approve-int" ref="industryArr" v-model="form.industryArr"></IndustryType>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="注册资本(元)：" prop="registerCapital">
                                    <el-input class="approve-int" v-model="form.registerCapital" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="实收资本(元)：" prop="paiclupCapital">
                                    <el-input class="approve-int" v-model="form.paiclupCapital" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="职工人数(人)：" prop="employeeNumber">
                                    <el-input class="approve-int" v-model="form.employeeNumber" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="年销售额(元)：" prop="sellSum">
                                    <el-input class="approve-int" v-model="form.sellSum" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="资产总额(元)：" prop="totalAssets">
                                    <el-input class="approve-int" v-model="form.totalAssets" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" class="discount-customer-guid">
                            <div class="bg-purple-dark">
                                <el-form-item label="业务员联系电话：" prop="mobile">
                                    <el-input class="approve-int" v-model="form.mobile" placeholder="请输入"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                </div>
            </div>
        </el-form>

        <DiscountTitle title="企业信息" class="discount-step2"/>
        <div class="discount-enter-box">
            <el-form :model="enterpriseForm" :rules="enterpriseRules" ref="enterpriseForm">
                <el-row>
                    <el-col :span="24">
                        <div class="discount-enter-title-box">
                            <div class="discount-enter-title">
                                <el-button type="text" class="register-btn-text">企业信息</el-button>
                            </div>
                        </div>
                    </el-col>
                </el-row>
                <div class="discount-enter-int-box form-box">
                    <div class="discount-enter-form edit-discount-customer">
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件类型：">
                                        <span>社会统一信用代码</span>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件编号：" prop="certId">
                                        <el-input v-model="enterpriseForm.certId" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件签发地址：" prop="cnIdRegCity">
                                        <DiscountAddress ref="enterpriseAddress" v-model="enterpriseForm.enterpriseAddress"></DiscountAddress>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件登记日期：" prop="regDate">
                                        <el-date-picker
                                                v-model="enterpriseForm.regDate"
                                                type="date"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions1">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="是否长期有效：" prop="certDeadline">
                                        <el-select class="sign-select" v-model="enterpriseForm.certDeadline" @change="enterpriseChange()" placeholder="请选择">
                                            <el-option
                                                    v-for="item in certDeadlineList"
                                                    :key="item.certDeadline"
                                                    :label="item.certDeadlineName"
                                                    :value="item.certDeadline">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件到期日期：" prop="idExpiry">
                                        <el-date-picker
                                                v-model="enterpriseForm.idExpiry"
                                                :disabled="enterpriseForm.certDeadline == 1"
                                                type="date"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </el-form>

            <el-form :model="addressForm" :rules="addressRules" ref="addressForm">
                <el-row>
                    <el-col :span="24">
                        <div class="grid-content bg-purple-dark discount-enter-title-box">
                            <div class="discount-enter-title">
                                <el-button type="text" class="register-btn-text">联系地址信息</el-button>
                            </div>
                        </div>
                    </el-col>
                </el-row>
                <div class="discount-enter-int-box form-box">
                    <div class="demo-ruleForm discount-enter-form edit-discount-customer">
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="地址类型：">
                                        <span>注册地址</span>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="地址所属地区：">
                                        <span>中华人民共和国</span>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="地址所属省/市：">
                                        <DiscountAddress ref="FcustomerAddressArray" v-model="addressForm.FcustomerAddressArray"></DiscountAddress>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="邮政编码：" prop="zipCode">
                                        <el-input v-model="addressForm.zipCode" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="16">
                                <div class="bg-purple-dark">
                                    <el-form-item label="地址详情：" prop="address1">
                                        <el-input v-model="addressForm.address1" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </el-form>

            <el-form :model="manageForm" :rules="manageRules" ref="manageForm">
                <el-row>
                    <el-col :span="24">
                        <div class="discount-enter-title-box">
                            <div class="discount-enter-title">
                                <el-button type="text" class="register-btn-text">高管信息</el-button>
                                <el-button type="primary" icon="iconfont icon-tianjia" class="add-info-btn" @click="addManager()">添加高管</el-button>
                            </div>
                        </div>
                    </el-col>
                </el-row>
                <div v-for="(item,index) in manageArray" :key="item.index" class="discount-enter-int-box form-box">
                    <div class="demo-ruleForm discount-enter-form edit-discount-customer discount-manager">
                        <span class="del-btn" v-if="manageArray.length > 1" @click="delManager(index)"><i class="iconfont icon-shanchu"></i>删除</span>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="职务：" prop="defaultPost">
                                        <el-select class="sign-select" v-model="item.defaultPost" placeholder="请选择">
                                            <el-option
                                                    v-for="item in defaultPostList"
                                                    :key="item.defaultPost"
                                                    :label="item.defaultPostName"
                                                    :value="item.defaultPost">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="姓名：">
                                        <el-input v-model="item.customerName" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件类型：" prop="certType">
                                        <el-select class="sign-select" v-model="item.certType" placeholder="请选择">
                                            <el-option
                                                    v-for="item in certTypeList"
                                                    :key="item.certType"
                                                    :label="item.certTypeName"
                                                    :value="item.certType">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件编号：">
                                        <el-input v-model="item.certId" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件签发城市：">
                                        <DiscountAddress ref="manageAddr" v-model="item.manageAddr"></DiscountAddress>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件登记日期：" prop="regDate">
                                        <el-date-picker
                                                v-model="item.regDate"
                                                type="date"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions1">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="是否长期有效：">
                                        <el-select class="sign-select" v-model="item.certDeadline" @change="manageChange(item, index)" placeholder="请选择">
                                            <el-option
                                                    v-for="item in certDeadlineList"
                                                    :key="item.certDeadline"
                                                    :label="item.certDeadlineName"
                                                    :value="item.certDeadline">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件到期日：" prop="idExpiry">
                                        <el-date-picker
                                                v-model="item.idExpiry"
                                                type="date"
                                                :disabled="item.certDeadline == 1"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </el-form>

            <el-form :model="stockHolderForm" :rules="rules" ref="stockHolderForm">
                <el-row class="discount-stockholder-title">
                    <el-col :span="24">
                        <div class="discount-enter-title-box">
                            <div class="discount-enter-title">
                                <el-button type="text" class="register-btn-text">
                                    股东信息
                                    <span class="discount-warm"><span class="warm-title"><i class="iconfont icon-tixing"></i><i style="font-weight: bold">提醒：</i></span>最大股东持股比例小于等于50%时，应填写多个股东。</span>
                                </el-button>
                                <el-button type="primary" icon="iconfont icon-tianjia" class="add-info-btn" @click="addStockHolder">添加股东</el-button>
                            </div>
                        </div>
                    </el-col>
                </el-row>
                <div v-for="(iten, index) in stockHolderArray" :key="iten.index" class="discount-enter-int-box form-box">
                    <div class="demo-ruleForm discount-enter-form edit-discount-customer discount-manager">
                        <span class="del-btn" v-if="stockHolderArray.length > 1" @click="delStockHolder(index)"><i class="iconfont icon-shanchu"></i>删除</span>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="姓名：">
                                        <el-input v-model="iten.customerName" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="出资方式：">
                                        <el-select class="sign-select" v-model="iten.relationShip" placeholder="请选择">
                                            <el-option
                                                    v-for="iten in relationShipList"
                                                    :key="iten.relationShip"
                                                    :label="iten.relationShipName"
                                                    :value="iten.relationShip">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="出资比例：">
                                        <el-input v-model="iten.investmentProp" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件类型：">
                                        <el-select class="sign-select" v-model="iten.certType" placeholder="请选择">
                                            <el-option
                                                    v-for="iten in certTypeList"
                                                    :key="iten.certType"
                                                    :label="iten.certTypeName"
                                                    :value="iten.certType">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件编号：">
                                        <el-input v-model="iten.certId" placeholder="请输入"></el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件签发城市：">
                                        <DiscountAddress ref="stockHolderAddr" v-model="iten.stockHolderAddr"></DiscountAddress>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件登记日期：">
                                        <el-date-picker
                                                v-model="iten.regDate"
                                                type="date"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions1">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="是否长期有效：">
                                        <el-select class="sign-select" v-model="iten.certDeadline" @change="stockHolderChange(iten, index)" placeholder="请选择">
                                            <el-option
                                                    v-for="iten in certDeadlineList"
                                                    :key="iten.certDeadline"
                                                    :label="iten.certDeadlineName"
                                                    :value="iten.certDeadline">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </div>
                            </el-col>
                            <el-col :span="8">
                                <div class="bg-purple-dark">
                                    <el-form-item label="证件到期日：">
                                        <el-date-picker
                                                v-model="iten.idExpiry"
                                                type="date"
                                                :disabled="iten.certDeadline == 1"
                                                placeholder="选择日期"
                                                :picker-options="pickerOptions">
                                        </el-date-picker>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </el-form>
        </div>

        <DiscountTitle title="图片信息" class="discount-step3"/>
        <div class="discount-enterimg-box">
            <el-form :model="imgForm" :rules="rules" ref="imgForm">
                <el-row>
                    <el-col :span="24">
                        <div class="grid-content bg-purple-dark discount-enter-title-box">
                            <div class="discount-enter-title discount-img">
                                <el-button type="text" class="register-btn-text">
                                    客户证件图片信息
                                    <span class="discount-warm"><span class="warm-title"><i class="iconfont icon-tixing"></i><i style="font-weight: bold">提醒：</i></span>复印件盖公章扫描件大小不能超过5M，支持文件类型为png、jpg，重新上传提交后将覆盖已上传文件。</span>
                                </el-button>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="24">
                        <div class="grid-content bg-purple-dark discount-img-info">
                            <div class="discount-img-info-box">
                                <div class="upload-img-box">
                                    <div class="up-img-title">营业执照</div>
                                    <div class="img-box">
                                        <ImageZoom
                                                :width='240'
                                                :height='332'
                                                :image="imgForm.fileUrl1"
                                        ></ImageZoom>
                                    </div>
                                    <div class="upload-btn">
                                        <UploaderImages @input="discountCredential" uploadText="上传营业执照"></UploaderImages>
                                    </div>
                                </div>
                                <div class="upload-img-box">
                                    <div class="up-img-title">法人代表身份证正反面</div>
                                    <div class="img-box">
                                        <!--<img :src="imgForm.fileUrl2" alt="">-->
                                        <ImageZoom
                                                :width='240'
                                                :height='332'
                                                :image="imgForm.fileUrl2"
                                        ></ImageZoom>
                                    </div>
                                    <div class="upload-btn">
                                        <UploaderImages @input="discountIdCart" uploadText="上传身份证"></UploaderImages>
                                    </div>
                                </div>
                                <div class="upload-img-box">
                                    <div class="up-img-title">协议签署页</div>
                                    <div class="img-box">
                                        <!--<img :src="imgForm.fileUrl4" alt="">-->
                                        <ImageZoom
                                                :width='240'
                                                :height='332'
                                                :image="imgForm.fileUrl4"
                                        ></ImageZoom>
                                    </div>
                                    <div class="upload-btn">
                                        <UploaderImages @input="discountSignOn" uploadText="上传协议签署页"></UploaderImages>
                                    </div>
                                </div>
                                <div class="discount-protocol-rem">
                                    <span class="discount-rem-span"><a href="https://hpx-pc.oss-cn-beijing.aliyuncs.com/hpxpic/qianshushiyitu.png" target="_blank"><i class="iconfont icon-chakan"></i><i class="discount-rem-span1">&nbsp;签署协议示意图</i></a></span>
                                    <span class="discount-rem-span discount-rem-btn"><a href="https://hpx-pc.oss-cn-beijing.aliyuncs.com/font/qianshu.pdf" target="_blank"><el-button type="text">下载协议签署页</el-button></a></span>
                                    <span class="discount-rem-span"><a href="https://hpx-pc.oss-cn-beijing.aliyuncs.com/font/qianshuxieyi.pdf" target="_blank">下载<i class="discount-rem-i">《电子银行承兑汇票快贴协议(v2.0版)》</i></a></span>
                                </div>
                            </div>
                        </div>
                    </el-col>
                </el-row>
                <FormForgetTitle forgetTitle="上年财务报表"/>
                <el-row>
                    <el-col :span="24">
                        <div class="grid-content bg-purple-dark discount-img-info">
                            <div class="discount-img-info-box2">
                                <div class="upload-img-box" style="margin-right: 6px;">
                                    <div class="up-img-title">利润表</div>
                                    <div class="img-box">
                                        <ImageZoom
                                            :width='238'
                                            :height='154'
                                            :image="imgForm.finance1"
                                        ></ImageZoom>
                                    </div>
                                    <div class="upload-btn">
                                        <UploaderImages @input="discountProf" uploadText="上传利润表"></UploaderImages>
                                    </div>
                                </div>
                                <div class="upload-img-box" style="margin-left: 6px;">
                                    <div class="up-img-title">资产负债表</div>
                                    <div class="img-box">
                                        <ImageZoom
                                            :width='238'
                                            :height='154'
                                            :image="imgForm.finance2"
                                        ></ImageZoom>
                                    </div>
                                    <div class="upload-btn">
                                        <UploaderImages @input="discountBalance" uploadText="上传资产负债表"></UploaderImages>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-col>
                </el-row>
            </el-form>
        </div>
        <el-row>
            <el-col :span="24">
                <div class="submit-btn discount-save-btn">
                    <el-button type="primary" size="medium" v-if="!this.isSave" @click="saveSpeed()">提交</el-button>
                    <el-button type="primary" size="medium" v-if="this.isSave" @click="saveSpeed()">修改</el-button>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script lang="ts">
    import { Vue, Component } from 'vue-property-decorator';
    import { orgNatureTypes, orgOwnerShipTypeTypes, certDeadlineTypes, defaultPostTypes, certTypeTypes, relationShipTypes } from '@/util/constantStatus';
    import { checkLoanCardID, checkCrditCode } from '@/util/format';
    import DiscountTitle from '@component/common/DiscountTitle.vue';
    import FormImages from '@component/common/FormImages.vue';
    import FormForgetTitle from '@component/common/FormForgetTitle.vue';
    import UploaderImages from '@component/common/UploaderImages.vue';
    import DiscountAddress from '@component/common/DiscountAddress.vue';
    import FinanceType from '@component/common/user/FinanceType.vue';
    import IndustryType from '@component/common/user/IndustryType.vue';
    import OrgType from '@component/common/user/OrgType.vue';
    import moment from 'moment';
    import ImageZoom from '@component/common/ImageZoom.vue';
    import _ from 'lodash';
    @Component({
        components: {
            DiscountTitle,
            FormImages,
            FormForgetTitle,
            UploaderImages,
            DiscountAddress,
            FinanceType,
            IndustryType,
            OrgType,
            ImageZoom
        }
    })
    export default class SpeedDiscount extends Vue {
        isSave:Boolean = false;
        isShow: Boolean = false;
        isShowOrg: Boolean = false;
        isShowIndustry: Boolean = false;
        isShowFinance () {
            this.isShow = true;
        }
        isShowOrgFn () {
            this.isShowOrg = true;
        }
        isShowIndustryFn () {
            this.isShowIndustry = true;
        }
        form = {
            enterpriseName: '',
            orgNature: '',
            loanCardNo: '',
            financeType1: '',
            orgType: '',
            orgOwnerShipType: '',
            industryType: '',
            registerCapital: '',
            paiclupCapital: '',
            employeeNumber: '',
            sellSum: '',
            totalAssets: '',
            mobile: '',
            finance: [],
            orgArr: [],
            industryArr: []
        }
        enterpriseForm = {
            certId: '',
            regDate: '',
            idExpiry: '',
            certDeadline: '',
            cnIdRegCity: '',
            enterpriseAddress: []
        }
        addressForm = {
            FcustomerAddressArray: [],
            city: '',
            zipCode: '',
            address1: ''
        }
        manageForm = {}
        stockHolderForm = {}
        imgForm = {
            fileUrl1: 'https://hpx-pc.oss-cn-beijing.aliyuncs.com/registerImgTem/businesslicense.png',
            fileUrl1_id: '',
            fileUrl2: 'https://hpx-pc.oss-cn-beijing.aliyuncs.com/registerImgTem/id-card.png',
            fileUrl2_id: '',
            fileUrl4: 'https://hpx-pc.oss-cn-beijing.aliyuncs.com/registerImgTem/sign-con.png',
            fileUrl4_id: '',
            // fileUrl3: '',
            finance1: 'https://hpx-pc.oss-cn-beijing.aliyuncs.com/registerImgTem/profitstatement.png',
            finance1_id: '',
            finance2: 'https://hpx-pc.oss-cn-beijing.aliyuncs.com/registerImgTem/balancesheet.png',
            finance2_id: ''
        }
        rules = {
            // enterpriseName: [
            //     {required: true, message: '请输入公司名称', trigger: 'blur'}
            // ],
            // orgNature: [
            //     {required: true, message: '请输入机构类型', trigger: 'blur'}
            // ],
            // loanCardNo: [
            //     {required: true, message: '请输入贷款卡号/中征号', trigger: 'blur'}
            // ],
            // financeType1: [
            //     {required: true, message: '请输入客户类型', trigger: 'blur'}
            // ],
            // orgType: [
            //     {required: true, message: '请输入企业类型', trigger: 'blur'}
            // ],
            // orgOwnerShipType: [
            //     {required: true, message: '请输入企业所有制类型', trigger: 'blur'}
            // ],
            // industryType: [
            //     {required: true, message: '请输入国际行业分类', trigger: 'blur'}
            // ],
            // registerCapital: [
            //     {required: true, message: '请输入注册资本', trigger: 'blur'}
            // ],
            // paiclupCapital: [
            //     {required: true, message: '请输入实收资本', trigger: 'blur'}
            // ],
            // employeeNumber: [
            //     {required: true, message: '请输入职工人数', trigger: 'blur'}
            // ],
            // sellSum: [
            //     {required: true, message: '请输入年销售额', trigger: 'blur'}
            // ],
            // totalAssets: [
            //     {required: true, message: '请输入资产总额', trigger: 'blur'}
            // ],
            // mobile: [
            //     {required: true, message: '请输入业务员联系电话', trigger: 'blur'},
            //     {
            //         pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
            //         max: 11,
            //         message: '请输入正确的联系电话',
            //         trigger: 'blur'
            //     }
            // ]
        }
        enterpriseRules = {
            // certId: [
            //     {required: true, message: '请输入证件编号', trigger: 'blur'}
            // ],
            // regDate: [
            //     {required: true, message: '请选择登记日期', trigger: 'blur'}
            // ],
            // idExpiry: [
            //     {required: true, message: '请选择到期日期', trigger: 'blur'}
            // ],
            // cnIdRegCity: [
            //     {required: true, message: '请选择地址', trigger: 'blur'}
            // ],
            // certDeadline: [
            //     {required: true, message: '请选择证件是否长期有效', trigger: 'blur'}
            // ]
        }
        addressRules = {
            // zipCode: [
            //     {required: true, message: '请输入邮政编码', trigger: 'blur'}
            // ],
            // city: [
            //     {required: true, message: '请选择地址', trigger: 'blur'}
            // ]
        }
        manageRules = {
            // relationShip: [
            //     {required: true, message: '请选择职位', trigger: 'blur'}
            // ],
            // customerName: [
            //     {required: true, trigger: 'blur'}
            // ]
        }

        manageArray = [{
            defaultPost: '',
            customerName: '',
            certType: '',
            regDate: '',
            idExpiry: '',
            certDeadline: '',
            cnIdRegCity: '',
            certId: '',
            manageAddr: []
        }]
        stockHolderArray = [{
            customerName: '',
            relationShip: '',
            certType: '',
            certId: '',
            regDate: '',
            idExpiry: '',
            certDeadline: '',
            cnIdRegCity: '',
            investmentProp: ''
        }]

        // 默认机构
        orgNatureList = orgNatureTypes;
        // 默认企业所有制类型
        orgOwnerShipTypeList = orgOwnerShipTypeTypes;
        // 证件是否长期有效
        certDeadlineList = certDeadlineTypes;
        // 高管职位
        defaultPostList = defaultPostTypes;
        // 证件类型
        certTypeList = certTypeTypes;
        // 出资方式
        relationShipList = relationShipTypes;

        // 企业信息--证件有效期
        enterpriseChange () {
            if (this.enterpriseForm.certDeadline == 1) {
                // 长期
                this.enterpriseForm.idExpiry = '9999/12/31';
            }else {
                this.enterpriseForm.idExpiry = '';
            }
        }
        // 高管证件到期日
        manageChange (item, index) {
            if (item.certDeadline == 1){
                this.manageArray[index].idExpiry = '9999/12/31'
            }else {
                this.manageArray[index].idExpiry = '';
            }
        }
        // 股东证件到期日
        stockHolderChange (iten, index) {
            if (iten.certDeadline == 1) {
                this.stockHolderArray[index].idExpiry = '9999/12/31'
            } else {
                this.stockHolderArray[index].idExpiry = ''
            }
        }

        pickerOptions = {
            disabledDate(time) {
                return time.getTime() < Date.now() - 8.64e7;
            }
        }
        pickerOptions1 = {
            disabledDate(time) {
                return time.getTime() > Date.now();
            }
        }

        // 添加高管
        addManager () {
            let manage = {
                defaultPost: '',
                customerName: '',
                certType: '',
                regDate: '',
                idExpiry: '',
                certDeadline: '',
                cnIdRegCity: '',
                certId: '',
                manageCityDataA: '',
                manageAddressDataA: '',
                manageAddr: []
            }
            this.manageArray.push(manage);
        }
        // 删除高管
        delManager (index) {
            this.manageArray.splice(index, 1);
        }
        // 添加股东
        addStockHolder () {
            let stockHolder = {
                customerName: '',
                relationShip: '',
                certType: '',
                certId: '',
                regDate: '',
                idExpiry: '',
                certDeadline: '',
                cnIdRegCity: '',
                investmentProp: '',
                stockCityData: '',
                stockAddressData:'',
                stockHolderAddr: []
            }
            this.stockHolderArray.push(stockHolder);
        }
        // 删除股东
        delStockHolder (index) {
            this.stockHolderArray.splice(index, 1);
        }

        // 速贴上传营业执照
        discountCredential (valData: any) {
            this.imgForm.fileUrl1 = valData.path;
            this.imgForm.fileUrl1_id = valData.id;
        }
        // 速贴上传身份证正反面
        discountIdCart(valData: any){
            this.imgForm.fileUrl2 = valData.path;
            this.imgForm.fileUrl2_id = valData.id;
        }
        // 速贴上传协议签署页
        discountSignOn(valData: any){
            this.imgForm.fileUrl4 = valData.path;
            this.imgForm.fileUrl4_id = valData.id;
        }
        // 速贴上传利润表
        discountProf(valData: any){
            this.imgForm.finance1 = valData.path;
            this.imgForm.finance1_id = valData.id;
        }
        // 速贴上传资产负债表
        discountBalance(valData: any){
            this.imgForm.finance2 = valData.path;
            this.imgForm.finance2_id = valData.id;
        }

        // 获取速贴注册信息
        getDiscountInfo () {
            this.$http.get('fbank/enterprise')
                .then((response) => {
                    if (response.data != null) {
                        if(response.data.fBankEnterprise != undefined && response.data.fBankEnterprise != null){
                            if(response.data.fBankEnterprise.id != '' && response.data.fBankEnterprise.id != null && response.data.fBankEnterprise.id != undefined){
                                if(response.data.fBankEnterprise.fbank_enterprise_status != 1 && response.data.fBankEnterprise.fbank_enterprise_status != '1'){
                                    this.isSave = true;
                                }
                                this.form = response.data.fBankEnterprise;
                                if (response.data.fBankEnterprise.certArray.length > 0){
                                    this.enterpriseForm = response.data.fBankEnterprise.certArray[0];
                                    this.enterpriseForm.enterpriseAddress = [this.enterpriseForm.province, this.enterpriseForm.municipality, this.enterpriseForm.cnIdRegCity];
                                    if (this.enterpriseForm.idExpiry == 'Invalid date'){
                                        this.enterpriseForm.idExpiry = '';
                                    }
                                    if (this.enterpriseForm.regDate == 'Invalid date') {
                                        this.enterpriseForm.regDate = '';
                                    }
                                    // 企业信息地址处理
                                    this.$refs.enterpriseAddress.init([this.enterpriseForm.province, this.enterpriseForm.municipality, this.enterpriseForm.cnIdRegCity]);
                                }
                                if (response.data.fBankEnterprise.addrArray.length > 0){
                                    this.addressForm = response.data.fBankEnterprise.addrArray[0];
                                    this.addressForm.FcustomerAddressArray = [this.addressForm.province, this.addressForm.municipality, this.addressForm.city];
                                    // 联系人地址处理
                                    this.$refs.FcustomerAddressArray.init([this.addressForm.province, this.addressForm.municipality, this.addressForm.city]);
                                }
                                if(response.data.fBankEnterprise.manageArray.length > 0){
                                    this.manageArray = response.data.fBankEnterprise.manageArray;
                                    this.manageArray.forEach((i,index)=>{
                                        if (i.relationShip == 'null'){
                                            i.defaultPost = '0100'
                                            i.relationShip = '0100'
                                        }
                                        if(i.cnIdRegCity == 'null'){
                                            i.cnIdRegCity = ''
                                        }
                                        if(i.idExpiry == 'Invalid date'){
                                            i.idExpiry = ''
                                        }
                                        if(i.regDate == 'Invalid date'){
                                            i.regDate = ''
                                        }
                                        i.defaultPost = i.relationShip;
                                        this.$refs.manageAddr[index].init([i.province, i.municipality, i.cnIdRegCity])
                                        i.manageAddr = [i.province, i.municipality, i.cnIdRegCity]
                                    });
                                }
                                if(response.data.fBankEnterprise.stockHolderArray.length > 0){
                                    this.stockHolderArray = response.data.fBankEnterprise.stockHolderArray;
                                    this.stockHolderArray.forEach((j,index) => {
                                        if(j.cnIdRegCity == 'null'){
                                            j.cnIdRegCity = '';
                                        }
                                        if(j.idExpiry == 'Invalid date'){
                                            j.idExpiry = ''
                                        }
                                        if(j.regDate == 'Invalid date'){
                                            j.regDate = ''
                                        }
                                        this.$refs.stockHolderAddr[index].init([j.province, j.municipality, j.cnIdRegCity])
                                    })
                                }
                                this.imgForm = response.data.fBankEnterprise;
                                // 客户类型
                                if (response.data.fBankEnterprise.financeType1Head != '' && response.data.fBankEnterprise.financeType1Head != null && response.data.fBankEnterprise.financeType1 != '' && response.data.fBankEnterprise.financeType1 != null){
                                    this.$refs.finance.init([response.data.fBankEnterprise.financeType1Head, response.data.fBankEnterprise.financeType1]);
                                }
                                // 企业类型
                                if (response.data.fBankEnterprise.orgTypeMap != '' && response.data.fBankEnterprise.orgTypeMap != null){
                                    this.$refs.orgArr.init([response.data.fBankEnterprise.orgTypeMap.orgType1, response.data.fBankEnterprise.orgTypeMap.orgType2]);
                                }
                                // 国际行业分类
                                if(response.data.fBankEnterprise.industryTypeMap != '' && response.data.fBankEnterprise.industryTypeMap != null){
                                    this.$refs.industryArr.init([response.data.fBankEnterprise.industryTypeMap.industryType1, response.data.fBankEnterprise.industryTypeMap.industryType2, response.data.fBankEnterprise.industryTypeMap.industryType3, response.data.fBankEnterprise.industryTypeMap.industryType4]);
                                }
                            }
                        }
                    }
                })
        }

        saveSpeed () {
            // console.log(this.form)
            // console.log(this.enterpriseForm)
            // console.log(this.addressForm)
            // console.log(this.manageArray)
            // console.log(this.stockHolderArray)
            if(!this.form.enterpriseName){
                this.$alert('请先输入公司名称','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.orgNature || this.form.orgNature == ''){
                this.$alert('请先选择机构类型','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.loanCardNo || this.form.loanCardNo == ''){
                this.$alert('请先输入贷款卡号/中证号！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!checkLoanCardID(this.form.loanCardNo)){
                this.$alert('请输入正确的贷款卡号/中证号！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.orgOwnerShipType || this.form.orgOwnerShipType == ''){
                this.$alert('请先选择企业所有制类型','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.registerCapital || this.form.registerCapital == ''){
                this.$alert('请先输入资本注册！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.paiclupCapital || this.form.paiclupCapital == ''){
                this.$alert('请先输入实收资本！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.employeeNumber || this.form.employeeNumber == ''){
                this.$alert('请先输入职工人数！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.sellSum || this.form.sellSum == ''){
                this.$alert('请先输入年销售额！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.totalAssets || this.form.totalAssets == ''){
                this.$alert('请先输入资产总额！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.form.mobile || this.form.mobile == ''){
                this.$alert('请正确输入业务联系电话！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.enterpriseForm.certId){
                this.$alert('请输入统一社会信用代码！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!checkCrditCode(this.enterpriseForm.certId)){
                this.$alert('请输入正确的统一社会信用代码！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(this.enterpriseForm.enterpriseAddress.length < 3 && this.enterpriseForm.cnIdRegCity == ''){
                this.$alert('请选择企业认证的证件签发详细城市！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.enterpriseForm.regDate || this.enterpriseForm.regDate == ''){
                this.$alert('请先输入企业认证的证件登记日期！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(this.enterpriseForm.certDeadline != 0 && this.enterpriseForm.certDeadline != 1){
                this.$alert('请先选择企业认证的证件有效期！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.enterpriseForm.idExpiry || this.enterpriseForm.idExpiry == ''){
                this.$alert('请输入正确的企业认证证件到期日期！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }

            if(this.addressForm.FcustomerAddressArray.length < 3 && this.addressForm.city == ''){
                this.$alert('请先选择联系人地址！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.addressForm.zipCode || this.addressForm.zipCode == ''){
                this.$alert('请输入邮政编码！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(!this.addressForm.address1 || this.addressForm.address1 == ''){
                this.$alert('请输入详细地址！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            // console.log(this.manageArray)
            let listManageArray = _.cloneDeep(this.manageArray);
            for (let i = 0; i < listManageArray.length; i ++){
                if (listManageArray[i].defaultPost == '') {
                    this.$alert('请选择高管职位！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].customerName == ''){
                    this.$alert('请输入高管姓名！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].certType == ''){
                    this.$alert('请选择高管证件类型！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].certId == ''){
                    this.$alert('请输入高管证件编号！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].manageAddr.length < 3 && listManageArray[i].cnIdRegCity == '') {
                    this.$alert('请选择高管地址！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].idExpiry == ''){
                    this.$alert('请选择登记日期！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].certDeadline != 0 && listManageArray[i].certDeadline != 1){
                    this.$alert('请选择到期期限！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listManageArray[i].regDate == ''){
                    this.$alert('请选择到期日期！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
            }
            let listStockHolderArray = _.cloneDeep(this.stockHolderArray);
            let stockHolderPer = ''
            for (let i = 0; i < listStockHolderArray.length; i ++){
                stockHolderPer += Number(listStockHolderArray[i].investmentProp)
                if (listStockHolderArray[i].customerName == ''){
                    this.$alert('请输入股东姓名！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].relationShip == '') {
                    this.$alert('请选择出资方式！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].certType == ''){
                    this.$alert('请选择股东证件类型！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].certId == ''){
                    this.$alert('请输入股东证件编号！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].certId == ''){
                    this.$alert('请输入股东证件编号！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].idExpiry == ''){
                    this.$alert('请选择登记日期！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (listStockHolderArray[i].certDeadline != 0 && listStockHolderArray[i].certDeadline != 1){
                    this.$alert('请选择到期期限！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
                if (stockHolderPer < 50){
                    this.$alert('出资比例小于50%，请再添加股东信息！','提示',{
                        confirmButtonText: '确定',
                        customClass: 'custom-message-box',
                        callback: action => {}
                    })
                    return;
                }
            }
            if (!this.imgForm.fileUrl1_id && !this.isSave || this.isSave && !this.imgForm.fileUrl1){
                this.$alert('请上传营业执照！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if (!this.imgForm.fileUrl2_id && !this.isSave || this.isSave && !this.imgForm.fileUrl2){
                this.$alert('请上传身份证正反面！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if (!this.imgForm.fileUrl4_id && !this.isSave || this.isSave && !this.imgForm.fileUrl4){
                this.$alert('请上传协议签署页！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if (!this.imgForm.finance1_id && !this.isSave || this.isSave && !this.imgForm.finance1){
                this.$alert('请上传利润表！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if (!this.imgForm.finance2_id && !this.isSave || this.isSave && !this.imgForm.finance2){
                this.$alert('请上传资产负债表！','提示',{
                    confirmButtonText: '确定',
                    customClass: 'custom-message-box',
                    callback: action => {}
                })
                return;
            }
            if(this.form.finance == undefined){
                this.form.financeType1 = this.form.financeType1;
            }else {
                this.form.financeType1 = this.form.finance.pop();
            }
            if(this.form.industryArr == undefined){
                this.form.industryType = this.form.industryType;
            }else {
                this.form.industryType = this.form.industryArr.pop();
            }
            if(this.form.orgArr == undefined){
                this.form.orgType = this.form.orgType;
            }else {
                this.form.orgType = this.form.orgArr.pop();
            }
            let sendEnterpriseForm = [
                {
                    certId: this.enterpriseForm.certId,
                    regDate: moment(this.enterpriseForm.regDate).format('YYYY/MM/DD'),
                    idExpiry: moment(this.enterpriseForm.idExpiry).format('YYYY/MM/DD'),
                    cnIdRegCity: this.enterpriseForm.enterpriseAddress.pop(),
                    certDeadline: this.enterpriseForm.certDeadline
                }
            ]
            let sendAddress = [{
                city: this.addressForm.FcustomerAddressArray.pop(),
                address1: this.addressForm.address1,
                zipCode: this.addressForm.zipCode
            }]
            this.manageArray.forEach((i) => {
                i.regDate = moment(i.regDate).format('YYYY/MM/DD');
                i.idExpiry = moment(i.idExpiry).format('YYYY/MM/DD');
                if(i.manageAddr == undefined){
                    i.cnIdRegCity = i.cnIdRegCity;
                }else {
                    i.cnIdRegCity = i.manageAddr.pop();
                }
                i.relationShip = i.defaultPost
            })
            this.stockHolderArray.forEach((j) => {
                j.regDate = moment(j.regDate).format('YYYY/MM/DD');
                j.idExpiry = moment(j.idExpiry).format('YYYY/MM/DD');
                if(j.stockHolderAddr == undefined){
                    j.cnIdRegCity = j.cnIdRegCity;
                }else {
                    j.cnIdRegCity = j.stockHolderAddr.pop();
                }
            })

            let sendData = {
                ...this.form,
                ...this.imgForm,
                certArray: sendEnterpriseForm,
                addrArray: sendAddress,
                manageArray: this.manageArray,
                stockHolderArray: this.stockHolderArray
            }
            // 修改 新增同一个接口，后台通过id判断
            this.$http.post('fbank/enterprise/register',sendData)
                .then((response) => {
                    if(response.status < 300){
                        this.$alert('您已申请开通速贴功能，银行预计将在工作日1小时内完成审核， 请耐心等待……','提醒',{
                            confirmButtonText: '我知道了',
                            customClass: 'custom-message-box',
                            callback: action => {
                                // 跳转速贴主页面
                                let backUrl = /back=.+$/.exec(location.hash);
                                location.href = backUrl && backUrl.length == 1 ? backUrl[0].split('=')[1] : "/discount.html";
                            }
                        })
                    }else {
                       this.getDiscountInfo()
                    }
                })
        }
        mounted () {
            this.getDiscountInfo();
            // let userinfo = localStorage.getItem('userInfo');
        }
    }
</script>

<style lang="scss" scoped>
    .demo-ruleForm1 {
        margin-top: 50px;
    }
    .discount-step1 {
        /*margin-top: 54px;*/
        margin-bottom: 25px;
    }
    .discount-step2 {
        margin-top: 50px;
        margin-bottom: 25px;
    }
    .discount-step3 {
        margin-top: 50px;
        margin-bottom: 25px;
    }
    .discount-save-btn {
        display: flex;
        justify-content: center;
        margin-bottom: 30px;
    }
    .discount-customer-box {
        display: flex;
        justify-content: center;
        .el-form-item {
            display: flex;
        }
        .edit-discount-customer {
            width: 82%;
        }
        .discount-customer-guid {
            display: flex;
            justify-content: center;
        }
    }
    .discount-enter-form {
        margin-top: 10px;
    }
    .discount-img {
        .el-button {
            padding-top: 0;
        }
    }
    .discount-img-info {
        display: flex;
        justify-content: center;
    }
    .discount-img-info-box {
        width: 58%;
        min-width: 840px;
        margin-top: 25px;
        margin-bottom: 20px;
        display: flex;
        justify-content: space-between;
        position: relative;

    }
    .discount-img-info-box2 {
        width: 38%;
        margin-bottom: 55px;
        display: flex;
        justify-content: space-between;
    }
    .discount-protocol-rem {
        position: absolute;
        bottom: 38px;
        right: -330px;
    }
    .h-text-btn {
        color: $__color-show;
        font-size: $__little-font-size;
    }
    .icon-tixing {
        color: $__color-remind;
    }
    .warm-title {
        color: $__color-label;
        font-size: $__font-size-default;
    }
    .discount-warm {
        color: $__color-label;
    }
    .add-info-btn {
        width: 108px;
        height: $height-int-register;
        border: 1px solid $__color-link;
        color: $__color-link;
        padding: 0;
        background: $__color-bg-multiple;
    }
    .discount-rem-span {
        display: block;
        width: 320px;
        margin-top: 15px;
    }
    .discount-rem-span1 {
        color: $__color-link;
        cursor: pointer;
        border-bottom: 1px solid $__color-link;
        /*padding-bottom: 1px;*/
    }
    .discount-rem-span {
        .discount-rem-i {
            color: $__color-link;
            cursor: pointer;
            border-bottom: 1px solid $__color-link;
        }
    }
    .discount-manager {
        position: relative;
    }
    .del-btn {
        position: absolute;
        right: 36px;
        top: 10px;
    }
    .del-btn {
        color: $__color-remind;
        cursor: pointer;
    }
    .up-img-title {
        text-align: center;
        margin-bottom: 16px;
        color: $__color-label;
    }
    .register-btn-text {
        font-size: $__font-size-default;
    }
    .discount-enter-title {
        height: $height-int-register;
        line-height: $height-int-register;
    }
    .check_error_box_speed {
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
        .check_error_con_speed {
            width: 84%;
            height: 32px;
            line-height: 32px;
            background: $__color-bg-unimportance;
            font-size: $__little-font-size;
            color: $__color-remind;
            .icon-jingshi {
                font-size: $__little-font-size;
            }
        }
    }
</style>
<style lang="scss">
    .discount-customer-box {
        .el-form-item__label {
            width: 144px;
        }
        .el-cascader{
            line-height: 32px;
        }
        .el-input__icon.el-icon-arrow-down{
            line-height: 32px;
        }
        .el-select .el-input .el-select__caret{
            line-height: 32px;
            color: $__color-show;
        }
    }
    .discount-enter-int-box {
        .el-form-item__label {
            width: 134px;
        }
    }
    .discount-manager {
        background: $__color-bg-primary;
        padding-top: 34px;
        padding-bottom: 10px;
        .el-input__inner {
            background: $__color-bg-primary;
        }
    }
    .discount-stockholder-title {
        margin-top: 25px;
    }
    .discount-img-info-box {
        .img-box {
            height: 340px;
        }
        /*.img-box {*/
            /*img {*/
                /*max-width: 240px;*/
                /*max-height: 332px;*/
            /*}*/
        /*}*/
    }
    .discount-enterimg-box {
        .form-forget-title .forget-title-span {
            width: 136px;
        }
        .form-forget-title {
            margin-bottom: 30px;
        }
    }
    .discount-enter-box {
        .el-form-item__content {
            width: 65%;
            .el-cascader {
                width: 100%;
                line-height: 32px;
            }
            .el-date-editor.el-input, .el-date-editor.el-input__inner {
                width: 100%;
            }
            .el-input__icon.el-icon-arrow-down{
                line-height: 32px;
            }
            .el-input__icon.el-icon-date{
                line-height: 32px;
            }
            .el-select .el-input .el-select__caret{
                line-height: 32px;
                color: $__color-show;
            }
        }
        .el-input {
            height: $height-int-register;
        }
        .el-input__inner {
            height: $height-int-register;
        }
    }
    .discount-enter-title {
        .icon-tianjia {
            font-size: $__little-font-size;
            margin-right: 4px;
        }
    }
    /*.icon-tianjia {*/
        /*margin-right: 4px;*/
        /*vertical-align: middle;*/
    /*}*/
    .icon-chakan {
        color: $__color-link;
    }
    .discount-rem-btn {
        .el-button--text {
            width: 128px;
            height: $height-int;
            border: 1px solid $__color-link;
            background: $__color-bg-multiple;
            color: $__color-link;
            padding: 0;
        }
    }
    .sign-select {
        width: 100%;
    }
</style>